﻿@page
@{ Layout = "_Layout"; }

<el-container>
  <el-main>
    <el-form v-on:submit.native.prevent :inline="true" size="small">
      <el-form-item label="文件夹路径" prop="directoryPaths">
        <el-cascader
          v-model="directoryPaths"
          :options="directories"
          :props="{ multiple: true, checkStrictly: true }"
          filterable
          v-on:change="reload"
          placeholder="请选择文件夹路径"></el-cascader>
      </el-form-item>
      <el-form-item label="文件夹路径/文件名">
        <el-input
          v-model="keyword"
          v-on:change="reload"
          placeholder="请输入文件夹路径名称或文件名称"
        ></el-input>
      </el-form-item>
    </el-form>

    <el-table :data="files" style="width: 100%">
      <el-table-column label="包含文件">
        <template slot-scope="scope">
          <el-link
            :underline="false"
            v-on:click="btnEditClick(scope.row)"
            type="primary">
            {{ scope.row.directoryPath + '/' + scope.row.fileName }}
          </el-link>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="130">
        <template slot-scope="scope">
          <el-link
            :underline="false"
            :href="getPageUrl(scope.row.directoryPath + '/' + scope.row.fileName)"
            target="_blank"
            type="primary">
            查看
          </el-link>
          <el-link
            :underline="false"
            v-on:click="btnEditClick(scope.row)"
            type="primary">
            编辑
          </el-link>
          <el-link
            :underline="false"
            type="danger"
            v-on:click="btnDeleteClick(scope.row)">
            删除
          </el-link>
        </template>
      </el-table-column>
    </el-table>

    <div style="height: 10px"></div>
    <el-divider></el-divider>
    <div style="height: 10px"></div>

    <el-button size="small" type="primary" v-on:click="btnAddClick">
      新增包含文件
    </el-button>
    <el-button size="small" type="primary" v-on:click="btnConfigClick">
      <i class="el-icon-setting"></i> 文件夹路径设置
    </el-button>
  </el-main>
</el-container>

<el-drawer
  id="configForm"
  v-if="configForm"
  title="文件夹路径设置"
  ref="configPanel"
  :visible.sync="configPanel"
  destroy-on-close
  direction="rtl"
  size="50%">
  <div class="drawer__content">
    <el-form v-on:submit.native.prevent ref="configForm" :model="configForm" label-width="150px" :rules="{
        includeDir: [
          { required: true, message: '请输入包含文件文件夹路径', trigger: 'blur' }
        ]
      }">
      <el-form-item label="包含文件文件夹路径" prop="includeDir">
        <el-input v-model="configForm.includeDir" placeholder="请输入包含文件文件夹路径"></el-input>
      </el-form-item>

      <el-divider></el-divider>
      <div class="drawer__footer">
        <el-button type="primary" v-on:click="btnConfigSubmitClick" size="small">确 定</el-button>
        <el-button size="small" v-on:click="btnConfigCancelClick">取 消</el-button>
      </div>
    </el-form>
  </div>
</el-drawer>

@section Scripts{
<script src="/sitefiles/assets/js/admin/cms/templatesIncludes.js" type="text/javascript"></script>
}
